<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>测试</title>
</head>
<body>
    <form id="test" onsubmit="return false;">
        <table>
            <tr>
                <td>价格</td>
                <td><input name="money" id="money" value="1"></td>
            </tr>
            <tr>
                <td colspan="2"><button type="button" id="su">支付</button></td>
            </tr>
        </table>
    </form>
<script src="jquery.min.js"></script>
<script>
    $('#su').click(function () {
        var m = $('#money').val();
        var data = {money:m};
        if (m > 0){
            $.ajax({
                type: 'post',
                url: 'pay',
                data: JSON.stringify(data),
                contentType: 'application/json',
                dataType:'json',
                success:function(data){
                    if (data.retCode == '1001000'){
                        var d = data.retData;
                        if (d && d.payURL){
                            location.href = d.payURL;
                        }
                    } else {
                        alert(data.retMsg+"");
                    }
                }
            })
        }
    })
</script>
</body>
</html>